package com.pengpeng.android.logic.main;


import com.pengpeng.android.activity.R;
import com.pengpeng.android.activity.PengPengActivity;

import android.app.Activity;
import android.content.Intent;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnTouchListener;
import android.widget.ImageButton;

public class TitB_MainTitleBar {
	
    private ImageButton mPPBtn=null; //碰碰按钮
    private OnTouchListener PPBtntouch=null;//碰碰按钮处理
    private Activity myactivity=null;
	
	public TitB_MainTitleBar()
	{
		
	}
	public void load(Activity activity)
	{
		myactivity=activity;
		myactivity.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.main_titlebar);
		
		loadmPPBtn();
	    
	    
	}//load
	
	private void loadmPPBtn()
	{
		mPPBtn=(ImageButton)myactivity.findViewById(R.id.pengpengbtn);
		PPBtntouch=new OnTouchListener()
	    {

			@Override
			public boolean onTouch(View v, MotionEvent event) 
			{
				// TODO Auto-generated method stub
				switch (event.getAction()) 
				{  
	               case MotionEvent.ACTION_UP:  
	              {  
	            	Intent readMsg=new Intent(myactivity,PengPengActivity.class);
	                readMsg.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	                myactivity.startActivity(readMsg);
	              }  
	               break;  
	            } 
				return false;
			}//onTouch
	    	
	    };//OnTouchListener
	    
	    mPPBtn.setOnTouchListener(PPBtntouch);
	}//loadmPPBtn()
	
}
